package com.treetao.union.db.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.treetao.union.db.mapper.MallOrderRecordMapper;
import com.treetao.union.db.model.MallOrderRecord;
import com.treetao.union.db.service.MallOrderRecordService;

/**
 * <p>
 * 订单主表 服务实现类
 * </p>
 *
 * @author Dev.M
 * @since 2020-04-11
 */
@Service
public class MallOrderRecordServiceImpl extends ServiceImpl<MallOrderRecordMapper, MallOrderRecord> implements MallOrderRecordService {

	@Override
	public List<MallOrderRecord> getOrderRecord(Long orderno) {
		QueryWrapper<MallOrderRecord> q = new QueryWrapper<MallOrderRecord>();
		q.eq("orderno", orderno);
		q.orderByDesc("op_time");
		return list(q);
	}

	@Override
	public boolean save(Long orderno, String content) {
		MallOrderRecord record = new MallOrderRecord();
		record.setContent(content);
		record.setOpTime(new Date());
		record.setOrderno(orderno);
		return save(record);
	}
}
